package Socket_Chat;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class ChatClient implements Runnable{
	public Socket socket;
	public ChatClient(Socket socket) {
		this.socket = socket;
	}
	
	@Override
	public void run() {
		try {
			Scanner scanner = new Scanner(System.in);
			OutputStream outputStream = socket.getOutputStream();
			while(true) {
				String sendMessage = scanner.nextLine();
				outputStream.write(sendMessage.getBytes());
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		
	}

}
